
<template>
  <div class="group-operation-box">
    <template v-if="selectTime">
      <group-operating-indicators :select-time="selectTime" />
      <operating-data :select-time="selectTime" />
      <monthly-execution-status :select-time="selectTime" />
    </template>
  </div>
</template>
<script>
import dayjs from 'dayjs';
// 不能和groupOperation/components/groupOperatingIndicators 共用原因  页面展示略有不同过
import groupOperatingIndicators from './components/groupOperatingIndicators';
// 不能和groupOperation/components/goperatingData 共用原因  弹窗是饼图
import operatingData from './components/operatingData';
// 不能和groupOperation/components/monthlyExecutionStatus 共用原因  接口不同
import monthlyExecutionStatus from './components/monthlyExecutionStatus';
import Api from '../../api/incomeAndExpenditurePlan';
export default {
  data() {
    return {};
  },
  methods: {
    // header上的提交
    submitTableCopy() {
      let planKey = this.$route.query.planKey ? this.$route.query.planKey : '';
      Api.submitTableCopy({ primaryKey: planKey }).then(res => {
        if (res.success) {
          router.go(0);
        }
      });
    },
  },
  computed: {
    selectTime() {
      let planDetail = this.$store.state.planDetail;
      let selectTime = null;
      if (planDetail.planMonth) {
        if  (parseInt(planDetail.planMonth) == 1) {
          selectTime = (planDetail.planYear - 1) + '-12';
        } else if (parseInt(planDetail.planMonth) > 9) {
          selectTime = planDetail.planYear + '-' + (planDetail.planMonth - 1);
        } else {
          selectTime = planDetail.planYear + '-0' + (planDetail.planMonth - 1);
        }
      }

      console.log('selectTime', selectTime);
      return selectTime;
    },
  },
  components: {
    groupOperatingIndicators,
    operatingData,
    monthlyExecutionStatus,
  },
};
</script>
<style lang='scss' scoped>
.btn-submit {
  position: fixed;
  top: 14px;
  right: 310px;
  z-index: 9999;
}
</style>